#include "Projectile.h"

#include "..\..\SGD Wrappers\SGD_GraphicsManager.h"
#include "..\\..\\SGD Wrappers\\SGD_MessageManager.h"
#include "..\Message Management\DeleteObjectMessage.h"
#include "..\Message Management\MessageID.h"

Projectile::Projectile()
{
	SetID(PROJECTILE);
	SetAnimation("Projectile");
}


Projectile::~Projectile()
{
}

int Projectile::Update(float dt)
{
	// Prevent HandlingCollision on enemies who are off screen
	if (!IsOnCamera())
	{
		// Send Destroy Object Message
		(new DeleteObjectMessage(this))->QueueMessage();
		return 0;
	}

	MobileObject::Update(dt);
	return 0;
}

void Projectile::HandleCollision(const GameObject* collision)
{
	if (collision->GetID() == PLAYER)
		(new DeleteObjectMessage(this))->QueueMessage();
}